import request from '@/utils/request';

/**
 * 获取影刀流程列表
 */
export function getWingknifeProcessList() {
  return request({
    url: '/api/wingknife/processes',
    method: 'get'
  });
}

/**
 * 获取影刀流程详情
 * @param {number} id 流程ID
 */
export function getWingknifeProcessDetail(id) {
  return request({
    url: `/api/wingknife/processes/${id}`,
    method: 'get'
  });
}

/**
 * 创建影刀流程
 * @param {Object} data 流程数据
 */
export function createWingknifeProcess(data) {
  // 确保数据格式符合API要求
  return request({
    url: '/api/wingknife/processes',
    method: 'post',
    data
  });
}

/**
 * 更新影刀流程
 * @param {number} id 流程ID
 * @param {Object} data 流程数据
 */
export function updateWingknifeProcess(id, data) {
  // 确保数据格式符合API要求
  return request({
    url: `/api/wingknife/processes/${id}`,
    method: 'put',
    data
  });
}

/**
 * 删除影刀流程
 * @param {number} id 流程ID
 */
export function deleteWingknifeProcess(id) {
  return request({
    url: `/api/wingknife/processes/${id}`,
    method: 'delete'
  });
}

/**
 * 运行影刀流程
 * @param {number} id 流程ID
 * @param {Object} additionalParams 额外参数
 */
export function runWingknifeProcess(id, params = null) {
  return request({
    url: `/api/wingknife/processes/${id}/run`,
    method: 'post',
    data: { params }
  });
}

/**
 * 获取影刀流程执行记录列表
 * @param {Object} params 查询参数
 */
export function getWingknifeExecutionList(params = {}) {
  return request({
    url: '/api/wingknife/executions',
    method: 'get',
    params
  });
}

/**
 * 获取影刀流程执行记录详情
 * @param {number} id 执行记录ID
 */
export function getWingknifeExecutionDetail(id) {
  return request({
    url: `/api/wingknife/executions/${id}`,
    method: 'get'
  });
}

/**
 * 删除影刀流程执行记录
 * @param {number} id 执行记录ID
 */
export function deleteWingknifeExecution(id) {
  return request({
    url: `/api/wingknife/executions/${id}`,
    method: 'delete'
  });
} 